﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows;
using LRSystem;
namespace LoWoTSniffer
{
    public class DataTypeTemplateSelector : DataTemplateSelector
    {
        public DataTemplate EnrollBeaconTemplate { get; set; }
        public DataTemplate EnrollRequestTemplate { get; set; }
        public DataTemplate EnrollResponseTemplate { get; set; }
        public DataTemplate DataBeaconTemplate { get; set; }
        public DataTemplate ConfirmedDataUpTemplate { get; set; }

        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            //CombinedEntity entity = item as CombinedEntity; //CombinedEnity为绑定数据对象
            //string typeName = entity.TypeName;
            if (item is EnrollBeacon)
            {
                return EnrollBeaconTemplate;
            }
            if (item is EnrollRequest)
            {
                return EnrollRequestTemplate;
            }
            if (item is  EnrollResponse)
            {
                return EnrollResponseTemplate;
            }
            if (item is DataBeacon)
            {
                return DataBeaconTemplate;
            }
            if (item is ConfirmedDataUp)
            {
                return ConfirmedDataUpTemplate;
            }

            return null;
        }
    }
}
